
#pragma once

#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Enemy2D.generated.h"

UCLASS()
class XCZ2_API AEnemy2D : public AActor
{
	GENERATED_BODY()

public:
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	class ACharacter2D* Player;
	
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	bool IsAlive = true;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	bool CanFollow = false;
	
protected:
	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	class USphereComponent* SphereComponent;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	class UPaperFlipbookComponent* EnemyFlipbook;

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite)
	class UPaperFlipbook* HeadFlipbookAsset;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	float MovementSpeed = 50.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	float StopDistance = 20.0f;

	UPROPERTY(EditAnywhere, BlueprintReadWrite)
	float DieForce = 50.0f;
	

	FTimerHandle DestroyTimer;

	
	
public:	
	AEnemy2D();
	virtual void BeginPlay() override;
	virtual void Tick(float DeltaTime) override;

	void Die();
	void OnDestroyTimerTimeout();
};
